package cn.jobstart.enums;

/**
 * @author sunke
 * @Date 2023-09-20 23:21:16
 * @description 学历
 */

import cn.jobstart.pubInter.EnumVO;

import java.util.ArrayList;
import java.util.List;

public enum ResumeBasicEducationFlagEnum {

    MIDDLE(1, "初中及以下"),
    SENIOR(2, "高中/中技/中专/职高"),
    JUNIOR(3, "大专"),
    UNDERGRADUATE(4, "本科"),
    MASTER(5, "硕士"),
    DOCTOR(6, "博士");


    public static String getDescByDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (ResumeBasicEducationFlagEnum var : ResumeBasicEducationFlagEnum.values()) {
            if (var.getDesc().indexOf(desc) >= 0) {
                return var.getDesc();
            }
        }
        return "未知";
    }


    private Integer type;
    private String desc;

    ResumeBasicEducationFlagEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static Integer getDescByType(String desc) {
        if (desc == null) {
            return null;
        }
        for (ResumeBasicEducationFlagEnum var : ResumeBasicEducationFlagEnum.values()) {
            if (var.getDesc().indexOf(desc) >= 0) {
                return var.getType().intValue();
            }
        }
        return 0;
    }

    public static String getDescByType(Integer type) {
        if (type == null) {
            type = 0;
        }
        for (ResumeBasicEducationFlagEnum var : ResumeBasicEducationFlagEnum.values()) {
            if (type == var.getType().intValue()) {
                return var.getDesc();
            }
        }
        return ResumeBasicEducationFlagEnum.values()[0].getDesc();
    }

    public static List<EnumVO> getDescs() {
        List list = new ArrayList();

        for (ResumeBasicEducationFlagEnum var : ResumeBasicEducationFlagEnum.values()) {
            EnumVO enumVO = new EnumVO();
            enumVO.setId(var.getType() + "");
            enumVO.setName(var.getDesc());
            list.add(enumVO);
        }


        return list;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

}
